<section id="cate_level">
    <select name="cate_id" id="level0">
        <option value="-1">请选择分类...</option>
        <?php foreach($cate_list as $cate_row){?>
            <option value="<?php echo $cate_row['cate_id']?>"><?php echo str_repeat('&nbsp;&nbsp;',$cate_row['level']).$cate_row['cate_name']?></option>
        <?php }?>
    </select>
</section>
<script>

    function sons(){
        var cate_id = $(this).val();
        var obj_id = this.id;
//alert(this.id);
        var sel_id =1+Number(this.id.substr(5));
        sel_id='level'+sel_id;
        if(obj_id=='level0'){
            // alert('lev0');
            $('#cate_level select[id=level1]').remove();
        }
        $('#cate_level select[id=level2]').remove();
        $.get('index.php?act=cate&op=ajax_level',{'cate_id':cate_id},function(data){

            if(data.length==0){return;} //返回空数组不向下执行
            $('#cate_level').append("<select id="+sel_id +" name='cate_id'><option value='-1'>请选择分类...</option></select>");
            $(data).each(function(){
                $('select[name=cate_id]:last').append("<option value="+this.cate_id+">"+this.cate_name+"</option>");
            });
        },'json');
    }
    $('select[id=level0]').bind('change',sons);
    $('select[id=level1]').live('change',sons);

</script>